#ifndef _DISP_CAMERA_H_
#define _DISP_CAMERA_H_

//	marco definition
#define SKE_INIT_CAMEAR_POS		{0, 0, 50}
#define SKE_INIT_CAMEAR_VP		{0, 0, 0}
#define SKE_INIT_CAMERA_LOOKUP	{0, 1, 0}

#define SKE_CAMERA_X_ROT_RATE	1
#define SKE_CAMERA_Y_ROT_RATE	1
#define SKE_CAMERA_TRANS_RATE	0.05

#include "../stdafx.h"
#include "../geometry/GeometryBase.h"

class CCamera
{
public:
	CCamera();
	~CCamera();

	void InitCamera(const CVertex3D position, const CVertex3D viewpoint, const CVector3D lookup);
	void SetCameraParas();
	CVertex3D GetCameraPosition();
	CVertex3D GetGlobalPosition(CVertex3D mvPosition);
	CVertex3D GetModelViewPosition(CVertex3D glPosition);

	void SetViewPort(double cx, double cy);
	void SetPerspectiveParas(double hAngle, double ratio, double zNear, double zFar);

	CVertex2D Project(CVertex3D p);
	CVertex3D UnProject(CVertex2D p);

	void ChangeViewPoint(double dAngX, double dAngY, double dTrans);

protected:
public:
	CVertex3D m_position;
	CVertex3D m_viewpoint;
	CVector3D m_lookup;

	GLint m_viewport[4];
	GLdouble m_mvmatrix[16], m_projmatrix[16];

	double m_angX;
	double m_angY;
	double m_trans;
};

#endif
